<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
    <h1>hello world</h1>
    <div id="app">
        <img src="./js/001.png" style="transform: rotate(180deg);"/>
        <h3>使用v-if，点击按钮，num开始自增</h3>
        <h3>当num大于10时，完成爆炸</h3>
        <br/>
        <h3>当前num值：{{num}}</h3>
        <button @click="num+=20">点击num自增</button>
        <h2 v-show="1 === 1">爆炸</h2>
        <div id="bid" :style="bidsty"></div>
    </div>
</body>
<script src="./js/vue.js"></script>
<script>
    Vue.config.devtools = true;
    const vm = new Vue({
        el:'#app',
        data: {
            num: 0,
            bidsty: {
                border: 'solid 1px',
                height: '10px',
                width:  '10px',
            },
        },
        watch: {
            num(newValue, oldValue) {
                if(newValue > 100) {
                    this.bidsty['backgroundColor'] = 'brown';
                } else {
                    this.bidsty['height'] = newValue + 'px';
                    this.bidsty['width'] = newValue + 'px';
                }
            }
        }
    })
</script>
</html>